<template>
	<view class="container">
		<web-view style="z-index: 1; position: relative;" :update-title="false" :src="Src"></web-view>
		<cover-view class="btn" v-if="Second<=0" @click="HasRead">我已阅读</cover-view>
		<cover-view class="unable" v-if="Second>0">阅读倒计时{{Second}}秒</cover-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				Src:'',
				Path:'',
				Second:5				
			};
		},
		onLoad(options) {
			uni.setNavigationBarTitle({title:options.Title});
			this.Src = this.Util.Domain +'/'+options.Path+'.html';
			this.Path=options.Path;
			var timer = setInterval(()=>{
				this.Second--;
				if(this.Second<=0){
					clearInterval(timer);
				}
			},1000);
		},
		methods:{
			HasRead(){
				if(this.Path=="OProtocol"){
					uni.$emit("OProtocol",1);
				}
				if(this.Path=="RProtocol"){
					uni.$emit("RProtocol",1);
				}
				if(this.Path=="Privacy"){
					uni.$emit("Privacy",1);
				}
				uni.navigateBack();
			}
		}
	}
</script>

<style lang="scss">
	.container{position:relative;}
	.btn{position: fixed; left:200rpx; bottom:50rpx; width:350rpx; height: 100rpx; line-height: 100rpx; font-size:34rpx; border-radius: 50rpx; z-index:99999999; text-align:center; background-color:#d13c13; color:#ffffff;}
	.unable{position: fixed; left:200rpx; bottom:50rpx; width:350rpx; height: 100rpx; line-height: 100rpx; font-size:34rpx; border-radius: 50rpx; z-index:99999999; text-align:center; background-color:#c4c2c2; color:#ffffff;}
</style>
